    The robot uses Pure Pursuit as path tracking algorithm. Pure Pursuit works by calculating the curvature that will move the robot from its current position to some goal position by doing an arc and not only a straight line.\\

Coordinates of the goal point are converted in robot coordinate system. Using these new coordinates the angle between the robot and the point is then retrieved from the followin formula : 
    \begin{displaymath}
        \alpha = atan2(y_R,x_R)
    \end{displaymath}
    
     The $atan2()$ function is used here because it is continuous in interval $]-\pi,\pi ]$ whereas $arctan()$ function is discontinuous for points $\frac{\pi}{2} + k\pi$ with $k \in \mathbb{Z}$.\\
     
To calculate the curvature towards the goal point, the radius of the circle that goes through the two points, i.e. the robot and the goal point, has to be known. The radius is decided by the linear distance between the robot and the goal point, and the difference between the y-coordinate of the goal in robot coordinate system, both of which we can calculate as described on figure \ref{imgcurv}.\\

The linear speed is computed from the radius and the angle by the following formula : 

\begin{displaymath}
    \nu = |r \alpha|
\end{displaymath}

The linear speed for the robot is then set to $\nu$ . The angular speed is set from the formula:

\begin{displaymath}
    \omega = \frac{\nu}{r}
\end{displaymath}

where is the linear speed $\nu$ and $r$ is the radius . This way the robot will move to the next point by doing an arc from its current position to the chosen point.

    \begin{figure}[H]
        \centering
        \includegraphics[scale=0.7]{img/curv.png}
        \caption{How to calculate the curvature}
        \label{imgcurv}
    \end{figure}